#!/bin/sh
# PCP QA Test No. 1520
# time_t on 32-bit platforms
#
# Copyright (c) 2024 Ken McDonell.  All Rights Reserved.
#

if [ $# -eq 0 ]
then
    seq=`basename $0`
    echo "QA output created by $seq"
else
    # use $seq from caller, unless not set
    [ -n "$seq" ] || seq=`basename $0`
    echo "QA output created by `basename $0` $*"
fi

# get standard environment, filters and checks
. ./common.product
. ./common.filter
. ./common.check

eval `$PCP_BINADM_DIR/pmconfig -L y2038_safe`
$y2038_safe || _notrun "PCP build is not Y2039-safe"


_cleanup()
{
    cd $here
    $sudo rm -rf $tmp $tmp.*
}

status=0	# success is the default!
trap "_cleanup; exit \$status" 0 1 2 3 15

_filter()
{
    sed \
	-e '/sizeof(__pmTimestamp):/s/: 12/: 12 or 16/' \
	-e '/sizeof(__pmTimestamp):/s/: 16/: 12 or 16/' \
	-e '/sizeof(struct timeval):/s/: 12/: 12 or 16/' \
	-e '/sizeof(struct timeval):/s/: 16/: 12 or 16/' \
	-e '/sizeof(struct timespec):/s/: 12/: 12 or 16/' \
	-e '/sizeof(struct timespec):/s/: 16/: 12 or 16/' \
    # end
}

# real QA test starts here
src/y2038 2>&1 | _filter

# success, all done
exit
